import Player from './Player'
import Deck from './Deck'

class Game {
  players: Player[]
  deck: Deck

  constructor(players: string[], isRemoveJoker = false) {
    this.players = players.map((name) => new Player(name))
    this.deck = new Deck(isRemoveJoker)
  }

  // 开始游戏
  startGame() {
    console.log('🎮 开始游戏')
    this.deck.shuffle()
  }

  // 出牌
  playRound(playerIndex: number, cardIndex: number) {
    const card = this.players[playerIndex].playCard(cardIndex)
    console.log(`${this.players[playerIndex].name} 出牌：${card.toString()}`)
  }
}

export default Game
